package com.liu.eduService.controller;


import com.liu.R;
import com.liu.eduService.entity.EduSubject;
import com.liu.eduService.entity.subject.oneSubject;
import com.liu.eduService.service.EduSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import javax.security.auth.Subject;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author LSJ
 * @since 2022-01-06
 */
@RestController
@RequestMapping("/eduService/subject")
@CrossOrigin
public class EduSubjectController {
    @Autowired
    private EduSubjectService service;

    @PostMapping("addSubject")
    public R saveSubject(MultipartFile file) throws IOException {
        service.importSubject(file,service);
        return R.ok();
    }

    // 获取 标题列表
    @GetMapping("/getSubject")
    public R getSubject(){

       List<oneSubject> subjectList= service.getSubject();
       return R.ok().data("list",subjectList);
    }
}

